/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eproject_sem2;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
 *
 * @author ZER0
 */
@SuppressWarnings("serial")
public class Interface extends javax.swing.JFrame {

    Login_Sever s = new Login_Sever();
    public static String EN;

    public static String getEN() {
        return EN;
    }
    public static String DP;

    public static String getDP() {
        return DP;
    }

    /**
     * Creates new form Interface
     */
    public Interface() {
        initComponents();
        this.setLocationRelativeTo(null);
        mnBusiness.setEnabled(false);
        mnDelivery.setEnabled(false);
        mnAccount.setEnabled(false);
        mnAccounting.setEnabled(false);
        mnAdministration.setEnabled(false);

        /**
         *
         */
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        dtpInterface = new javax.swing.JDesktopPane();
        jpGoldTime = new javax.swing.JPanel();
        jpLogin = new javax.swing.JPanel();
        tfUser = new javax.swing.JTextField();
        lbUser = new javax.swing.JLabel();
        lbPass = new javax.swing.JLabel();
        pfPassWord = new javax.swing.JPasswordField();
        btLogin = new javax.swing.JButton();
        btnISever = new javax.swing.JButton();
        lblIcon = new javax.swing.JLabel();
        jpImformation = new javax.swing.JPanel();
        lblEmployeeIDM = new javax.swing.JLabel();
        lblEmployeeIDMS = new javax.swing.JLabel();
        lblEmployeeNameM = new javax.swing.JLabel();
        lbDepartmentsM = new javax.swing.JLabel();
        lbEmployeeNameMS = new javax.swing.JLabel();
        lbDepartmentsMS = new javax.swing.JLabel();
        btLogout = new javax.swing.JButton();
        mnbMenu = new javax.swing.JMenuBar();
        mnBusiness = new javax.swing.JMenu();
        mniVotesSent = new javax.swing.JMenuItem();
        mnSprice = new javax.swing.JMenu();
        mnitSPArea = new javax.swing.JMenuItem();
        mnitSPDistance = new javax.swing.JMenuItem();
        mnitSPParce = new javax.swing.JMenuItem();
        mnitSPWeight = new javax.swing.JMenuItem();
        mnitListCustomer = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        mnitExit1 = new javax.swing.JMenuItem();
        mnDelivery = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        mnAccounting = new javax.swing.JMenu();
        mnitUArea = new javax.swing.JMenuItem();
        mnUpdatePrice = new javax.swing.JMenu();
        mnitByDistance = new javax.swing.JMenuItem();
        mnitByWeight = new javax.swing.JMenuItem();
        mnitByParce = new javax.swing.JMenuItem();
        mnAdministration = new javax.swing.JMenu();
        mnitListEmployee = new javax.swing.JMenuItem();
        mnitCreateAccount = new javax.swing.JMenuItem();
        menuITDepartment = new javax.swing.JMenuItem();
        mnAccount = new javax.swing.JMenu();
        mnitEditPassWord = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jpGoldTime.setBackground(new java.awt.Color(226, 226, 228));
        jpGoldTime.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1), "GoldTime", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 2, 18), new java.awt.Color(0, 0, 0))); // NOI18N

        jpLogin.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        lbUser.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbUser.setText("User:");

        lbPass.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbPass.setText("PassWord:");

        pfPassWord.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pfPassWordActionPerformed(evt);
            }
        });

        btLogin.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/eproject_sem2/Icon/icon_login.png"))); // NOI18N
        btLogin.setText("Login");
        btLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btLoginActionPerformed(evt);
            }
        });

        btnISever.setIcon(new javax.swing.ImageIcon(getClass().getResource("/eproject_sem2/Icon/database.png"))); // NOI18N
        btnISever.setText("Instal sever");
        btnISever.setDefaultCapable(false);
        btnISever.setDisplayedMnemonicIndex(9);
        btnISever.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnISeverActionPerformed(evt);
            }
        });

        lblIcon.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        lblIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/eproject_sem2/Icon/Log-Out-icon.png"))); // NOI18N
        lblIcon.setLabelFor(pfPassWord);
        lblIcon.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        lblIcon.setIconTextGap(1);

        javax.swing.GroupLayout jpLoginLayout = new javax.swing.GroupLayout(jpLogin);
        jpLogin.setLayout(jpLoginLayout);
        jpLoginLayout.setHorizontalGroup(
            jpLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpLoginLayout.createSequentialGroup()
                .addContainerGap(33, Short.MAX_VALUE)
                .addComponent(lblIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 276, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jpLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpLoginLayout.createSequentialGroup()
                        .addGap(74, 74, 74)
                        .addComponent(btLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 147, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpLoginLayout.createSequentialGroup()
                        .addGroup(jpLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jpLoginLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(lbPass)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(pfPassWord, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpLoginLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(lbUser)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(tfUser, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(47, 47, 47))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpLoginLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnISever)
                        .addGap(13, 13, 13))))
        );
        jpLoginLayout.setVerticalGroup(
            jpLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpLoginLayout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(lblIcon)
                .addContainerGap(58, Short.MAX_VALUE))
            .addGroup(jpLoginLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnISever, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(42, 42, 42)
                .addGroup(jpLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbUser))
                .addGap(18, 18, 18)
                .addGroup(jpLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(pfPassWord, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbPass))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btLogin)
                .addGap(34, 34, 34))
        );

        javax.swing.GroupLayout jpGoldTimeLayout = new javax.swing.GroupLayout(jpGoldTime);
        jpGoldTime.setLayout(jpGoldTimeLayout);
        jpGoldTimeLayout.setHorizontalGroup(
            jpGoldTimeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpGoldTimeLayout.createSequentialGroup()
                .addGap(114, 114, 114)
                .addComponent(jpLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(125, Short.MAX_VALUE))
        );
        jpGoldTimeLayout.setVerticalGroup(
            jpGoldTimeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpGoldTimeLayout.createSequentialGroup()
                .addGap(74, 74, 74)
                .addComponent(jpLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(134, Short.MAX_VALUE))
        );

        jpGoldTime.setBounds(0, 0, 920, 580);
        dtpInterface.add(jpGoldTime, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jpImformation.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder()));
        jpImformation.setOpaque(false);
        jpImformation.setPreferredSize(new java.awt.Dimension(900, 30));
        jpImformation.setVerifyInputWhenFocusTarget(false);

        lblEmployeeIDM.setText("EmployeeID:");

        lblEmployeeIDMS.setText("XXXX");

        lblEmployeeNameM.setText("Employee Name:");

        lbDepartmentsM.setText("Departments:");

        lbEmployeeNameMS.setText("XXXXX");

        lbDepartmentsMS.setText("XXXX");

        btLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/eproject_sem2/Icon/Logout-01.png"))); // NOI18N
        btLogout.setText("Log out");
        btLogout.setBorder(null);
        btLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btLogoutActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpImformationLayout = new javax.swing.GroupLayout(jpImformation);
        jpImformation.setLayout(jpImformationLayout);
        jpImformationLayout.setHorizontalGroup(
            jpImformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpImformationLayout.createSequentialGroup()
                .addGap(224, 224, 224)
                .addComponent(lblEmployeeIDM)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblEmployeeIDMS)
                .addGap(62, 62, 62)
                .addComponent(lblEmployeeNameM)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbEmployeeNameMS)
                .addGap(93, 93, 93)
                .addComponent(lbDepartmentsM)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbDepartmentsMS)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 91, Short.MAX_VALUE)
                .addComponent(btLogout, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(37, 37, 37))
        );
        jpImformationLayout.setVerticalGroup(
            jpImformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpImformationLayout.createSequentialGroup()
                .addGroup(jpImformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btLogout)
                    .addComponent(lbDepartmentsMS)
                    .addComponent(lbDepartmentsM)
                    .addComponent(lbEmployeeNameMS)
                    .addComponent(lblEmployeeNameM)
                    .addComponent(lblEmployeeIDMS)
                    .addComponent(lblEmployeeIDM))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        mnbMenu.setBackground(new java.awt.Color(102, 102, 102));
        mnbMenu.setBorderPainted(false);

        mnBusiness.setText("Business");

        mniVotesSent.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        mniVotesSent.setText("Votes Sent");
        mniVotesSent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniVotesSentActionPerformed(evt);
            }
        });
        mnBusiness.add(mniVotesSent);

        mnSprice.setText("Show price");

        mnitSPArea.setText("Price Area");
        mnitSPArea.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitSPAreaActionPerformed(evt);
            }
        });
        mnSprice.add(mnitSPArea);

        mnitSPDistance.setText("Price Distance");
        mnitSPDistance.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitSPDistanceActionPerformed(evt);
            }
        });
        mnSprice.add(mnitSPDistance);

        mnitSPParce.setText("Price Parce");
        mnitSPParce.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitSPParceActionPerformed(evt);
            }
        });
        mnSprice.add(mnitSPParce);

        mnitSPWeight.setText("Price by Weight");
        mnitSPWeight.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitSPWeightActionPerformed(evt);
            }
        });
        mnSprice.add(mnitSPWeight);

        mnBusiness.add(mnSprice);

        mnitListCustomer.setText("List Customer");
        mnitListCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitListCustomerActionPerformed(evt);
            }
        });
        mnBusiness.add(mnitListCustomer);

        jMenuItem2.setText("Show list Votes Sent");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        mnBusiness.add(jMenuItem2);
        mnBusiness.add(jSeparator1);

        mnitExit1.setText("Exit");
        mnitExit1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitExit1ActionPerformed(evt);
            }
        });
        mnBusiness.add(mnitExit1);

        mnbMenu.add(mnBusiness);

        mnDelivery.setText("Delivery");

        jMenuItem1.setText("jMenuItem1");
        mnDelivery.add(jMenuItem1);

        mnbMenu.add(mnDelivery);

        mnAccounting.setText("Accounting");

        mnitUArea.setText("Update Area");
        mnitUArea.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitUAreaActionPerformed(evt);
            }
        });
        mnAccounting.add(mnitUArea);

        mnUpdatePrice.setText("Update price");

        mnitByDistance.setText("By Distance");
        mnitByDistance.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitByDistanceActionPerformed(evt);
            }
        });
        mnUpdatePrice.add(mnitByDistance);

        mnitByWeight.setText("By Weight");
        mnitByWeight.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitByWeightActionPerformed(evt);
            }
        });
        mnUpdatePrice.add(mnitByWeight);

        mnitByParce.setText("By Parce");
        mnitByParce.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitByParceActionPerformed(evt);
            }
        });
        mnUpdatePrice.add(mnitByParce);

        mnAccounting.add(mnUpdatePrice);

        mnbMenu.add(mnAccounting);

        mnAdministration.setText("Administration");

        mnitListEmployee.setText("List Employee");
        mnitListEmployee.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitListEmployeeActionPerformed(evt);
            }
        });
        mnAdministration.add(mnitListEmployee);

        mnitCreateAccount.setText("Create Account");
        mnitCreateAccount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitCreateAccountActionPerformed(evt);
            }
        });
        mnAdministration.add(mnitCreateAccount);

        menuITDepartment.setText("Departments");
        menuITDepartment.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuITDepartmentActionPerformed(evt);
            }
        });
        mnAdministration.add(menuITDepartment);

        mnbMenu.add(mnAdministration);

        mnAccount.setText("Account");

        mnitEditPassWord.setText("Edit Password");
        mnitEditPassWord.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnitEditPassWordActionPerformed(evt);
            }
        });
        mnAccount.add(mnitEditPassWord);

        mnbMenu.add(mnAccount);

        setJMenuBar(mnbMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(dtpInterface)
            .addComponent(jpImformation, javax.swing.GroupLayout.DEFAULT_SIZE, 919, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jpImformation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(dtpInterface, javax.swing.GroupLayout.DEFAULT_SIZE, 574, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void pfPassWordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pfPassWordActionPerformed
        try {
            // TODO add your handling code here:
            if ("addmin".equalsIgnoreCase(pfPassWord.getText()) && "addmin".equalsIgnoreCase(tfUser.getText())) {
                jpLogin.setVisible(false);
            } else {
                String sa = MH_MD5.MD5(pfPassWord.getText());
                if ((s.CheckUSer(tfUser.getText(), sa) == null)) {
                    JOptionPane.showMessageDialog(rootPane, "Account does not exist or the password is incorrect, please check again.");
                } else {
                    btLogout.setVisible(true);
                    EN = s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 3);
                    DP = s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6);
                    jpImformation.setVisible(true);
                    lblEmployeeIDMS.setText(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 2));
                    lbEmployeeNameMS.setText(EN);
                    lbDepartmentsMS.setText(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6));
                    jpLogin.setVisible(false);
                    if ("Business".equalsIgnoreCase(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6))) {
                    }
                    if ("Delivery".equalsIgnoreCase(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6))) {
                    }
                    if ("Accounting".equalsIgnoreCase(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6))) {
                    }
                    if ("Administration".equalsIgnoreCase(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6))) {
                    }
                }
            }
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_pfPassWordActionPerformed

    @SuppressWarnings("deprecation")
    private void btLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLoginActionPerformed
        try {
            // TODO add your handling code here:
            if ("addmin".equalsIgnoreCase(pfPassWord.getText()) && "addmin".equalsIgnoreCase(tfUser.getText())) {
                jpLogin.setVisible(false);
            } else {
                String sa = MH_MD5.MD5(pfPassWord.getText());
                if ((s.CheckUSer(tfUser.getText(), sa) == null)) {
                    JOptionPane.showMessageDialog(rootPane, "Account does not exist or the password is incorrect, please check again.");
                } else {
                    EN = s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 3);
                    lblEmployeeIDMS.setText(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 2));
                    lbEmployeeNameMS.setText(EN);
                    lbDepartmentsMS.setText(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6));
                    jpLogin.setVisible(false);
                    if ("Business".equalsIgnoreCase(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6))) {
                    }
                    if ("Delivery".equalsIgnoreCase(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6))) {
                    }
                    if ("Accounting".equalsIgnoreCase(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6))) {
                    }
                    if ("Administration".equalsIgnoreCase(s.CheckName((s.CheckUSer(tfUser.getText(), sa)), 6))) {
                    }
                }
            }
        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btLoginActionPerformed

    private void btLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLogoutActionPerformed
        // TODO add your handling code here:
        dispose();
        new Interface().setVisible(true);
    }//GEN-LAST:event_btLogoutActionPerformed

    private void mniVotesSentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniVotesSentActionPerformed
        // TODO add your handling code here:
        VotesSent vs;
        try {
            if (dtpInterface.getAllFrames().length == 1) {
                JOptionPane.showMessageDialog(this, "You have to shut down open applications");
            } else {
                vs = new VotesSent();
                vs.getItfVS().setSize(930, 570);
                dtpInterface.removeAll();
                dtpInterface.add(vs.getItfVS());


            }
        } catch (SQLException ex) {
            Logger.getLogger(VotesSent.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(VotesSent.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_mniVotesSentActionPerformed

    private void mnitSPAreaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitSPAreaActionPerformed

        Show_Price_Area spa = new Show_Price_Area();
        // TODO add your handling code here:
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            spa.getItfPArea().setSize(930, 570);
            dtpInterface.add(spa.getItfPArea());
        }
    }//GEN-LAST:event_mnitSPAreaActionPerformed

    private void mnitSPDistanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitSPDistanceActionPerformed
        // TODO add your handling code here:
        Show_Price_distance spd = new Show_Price_distance();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            spd.getItfDistance().setSize(930, 570);
            dtpInterface.add(spd.getItfDistance());
        }
    }//GEN-LAST:event_mnitSPDistanceActionPerformed

    private void mnitSPParceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitSPParceActionPerformed
        // TODO add your handling code here:
        Show_price_Parce spp = new Show_price_Parce();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            spp.getItfParce().setSize(930, 570);
            dtpInterface.add(spp.getItfParce());
        }
    }//GEN-LAST:event_mnitSPParceActionPerformed

    private void mnitSPWeightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitSPWeightActionPerformed
        // TODO add your handling code here:
        Show_price_weight spw = new Show_price_weight();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            spw.getItfPricesWeight().setSize(930, 570);
            dtpInterface.add(spw.getItfPricesWeight());
        }
    }//GEN-LAST:event_mnitSPWeightActionPerformed

    private void mnitListCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitListCustomerActionPerformed
        // TODO add your handling code here:
        ShowCustomer sc = new ShowCustomer();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            sc.getItnfShowCustomer().setSize(930, 570);
            dtpInterface.add(sc.getItnfShowCustomer());
        }
    }//GEN-LAST:event_mnitListCustomerActionPerformed

    private void mnitExit1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitExit1ActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_mnitExit1ActionPerformed

    private void mnitUAreaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitUAreaActionPerformed
        // TODO add your handling code here:
        ListofArea la = new ListofArea();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            la.getItnfUpdateAera().setSize(930, 570);
            dtpInterface.add(la.getItnfUpdateAera());
        }
    }//GEN-LAST:event_mnitUAreaActionPerformed

    private void mnitByDistanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitByDistanceActionPerformed
        // TODO add your handling code here:
        Prices_by_distance pbd = new Prices_by_distance();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            pbd.getItnfPriceByDistance().setSize(930, 570);
            dtpInterface.add(pbd.getItnfPriceByDistance());
        }
    }//GEN-LAST:event_mnitByDistanceActionPerformed

    private void mnitByWeightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitByWeightActionPerformed
        // TODO add your handling code here:
        Prices_by_weight pbw = new Prices_by_weight();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            pbw.getItnfPriceByWeight().setSize(930, 570);
            dtpInterface.add(pbw.getItnfPriceByWeight());
        }
    }//GEN-LAST:event_mnitByWeightActionPerformed

    private void mnitByParceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitByParceActionPerformed
        // TODO add your handling code here:
        Prices_by_Parce pbp = new Prices_by_Parce();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            pbp.getItnfPriceByParce().setSize(930, 570);
            dtpInterface.add(pbp.getItnfPriceByParce());
        }
    }//GEN-LAST:event_mnitByParceActionPerformed

    private void mnitListEmployeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitListEmployeeActionPerformed
        try {
            // TODO add your handling code here:
            Employee e = new Employee();
            if (dtpInterface.getAllFrames().length == 1) {
                JOptionPane.showMessageDialog(this, "You have to shut down open applications");
            } else {
                dtpInterface.removeAll();
                e.getItnfEmployee().setSize(930, 570);
                dtpInterface.add(e.getItnfEmployee());


            }
        } catch (SQLException ex) {
            Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_mnitListEmployeeActionPerformed

    private void mnitCreateAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitCreateAccountActionPerformed
        // TODO add your handling code here:
        Create_Account ca = new Create_Account();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            ca.getItnfCreateAccount().setSize(930, 570);
            dtpInterface.add(ca.getItnfCreateAccount());
        }
    }//GEN-LAST:event_mnitCreateAccountActionPerformed

    private void mnitEditPassWordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnitEditPassWordActionPerformed
        // TODO add your handling code here:
        Edit_Password ep = new Edit_Password();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            ep.getjInternalFrame1().setSize(930, 570);
            dtpInterface.add(ep.getjInternalFrame1());
        }
    }//GEN-LAST:event_mnitEditPassWordActionPerformed

    private void btnISeverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnISeverActionPerformed
        // TODO add your handling code here:
        new Install_sever().setVisible(true);
    }//GEN-LAST:event_btnISeverActionPerformed

    private void menuITDepartmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuITDepartmentActionPerformed
        // TODO add your handling code here:
        Departments d = new Departments();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            d.getItnfPriceByParce().setSize(930, 570);
            dtpInterface.add(d.getItnfPriceByParce());
        }
    }//GEN-LAST:event_menuITDepartmentActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        Show_List_VotesSent slv = new Show_List_VotesSent();
        if (dtpInterface.getAllFrames().length == 1) {
            JOptionPane.showMessageDialog(this, "You have to shut down open applications");
        } else {
            dtpInterface.removeAll();
            slv.getItnfShowListV().setSize(930, 570);
            dtpInterface.add(slv.getItnfShowListV());
        }
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;


                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Interface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Interface().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btLogin;
    private javax.swing.JButton btLogout;
    private javax.swing.JButton btnISever;
    private javax.swing.JDesktopPane dtpInterface;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPanel jpGoldTime;
    private javax.swing.JPanel jpImformation;
    private javax.swing.JPanel jpLogin;
    private javax.swing.JLabel lbDepartmentsM;
    private javax.swing.JLabel lbDepartmentsMS;
    private javax.swing.JLabel lbEmployeeNameMS;
    private javax.swing.JLabel lbPass;
    private javax.swing.JLabel lbUser;
    private javax.swing.JLabel lblEmployeeIDM;
    private javax.swing.JLabel lblEmployeeIDMS;
    private javax.swing.JLabel lblEmployeeNameM;
    private javax.swing.JLabel lblIcon;
    private javax.swing.JMenuItem menuITDepartment;
    private javax.swing.JMenu mnAccount;
    private javax.swing.JMenu mnAccounting;
    private javax.swing.JMenu mnAdministration;
    private javax.swing.JMenu mnBusiness;
    private javax.swing.JMenu mnDelivery;
    private javax.swing.JMenu mnSprice;
    private javax.swing.JMenu mnUpdatePrice;
    private javax.swing.JMenuBar mnbMenu;
    private javax.swing.JMenuItem mniVotesSent;
    private javax.swing.JMenuItem mnitByDistance;
    private javax.swing.JMenuItem mnitByParce;
    private javax.swing.JMenuItem mnitByWeight;
    private javax.swing.JMenuItem mnitCreateAccount;
    private javax.swing.JMenuItem mnitEditPassWord;
    private javax.swing.JMenuItem mnitExit1;
    private javax.swing.JMenuItem mnitListCustomer;
    private javax.swing.JMenuItem mnitListEmployee;
    private javax.swing.JMenuItem mnitSPArea;
    private javax.swing.JMenuItem mnitSPDistance;
    private javax.swing.JMenuItem mnitSPParce;
    private javax.swing.JMenuItem mnitSPWeight;
    private javax.swing.JMenuItem mnitUArea;
    private javax.swing.JPasswordField pfPassWord;
    private javax.swing.JTextField tfUser;
    // End of variables declaration//GEN-END:variables
}
